function createUserList() {
  return [
    { userId: 1, userName: "admin", password: "123456",token:'123456789' },
    { userId: 2, userName: "asdqwe", password: "456789",token:'123456789' },
  ];
}

export default [
  {
    url: "/api/user/login",
    method: "post",
    response: ({body}) => {
      const { userName, password } = body;
			console.log( userName, password,'登录');
      const checkUser = createUserList().find(
        (item) => item.userName === userName && item.password === password
      );
      //没有用户返回失败信息
      if (!checkUser) {
        return { code: 201, data: { message: "账号或密码不正确" } };
      }
      //如果有返回成功信息
      const {token} = checkUser;
      return { code: 200, data: { token } };
    },
  },
	{
    url: "/api/user/info",
    method: "get",
    response: (query) => {
      //token
			const token = query.header.token
			const checkUser = createUserList().find((item)=>item.token === token)

			if(checkUser){
				return {code:201,data:{message:'获取失败'}}
			}

			return{code:200,data:{checkUser}}
    },
  }
];
